<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Tariff extends Model
{
    use Common, SoftDeletes;

    protected $table = 'tariff';

    protected $casts = [
        'basics' => 'array',
        'mileage' => 'array',
        'duration' => 'array',
        'distance' => 'array',
        'waiting_timeout' => 'array',
        'other_settings' => 'array',
        'starting_price' => 'array'
    ];


    /**
     * 所属公司
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @Author 姿势就是力量
     */
    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id', 'id');
    }


    /**
     * 业务类型
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @Author 姿势就是力量
     */
    public function service_type()
    {
        return $this->belongsTo(ServiceType::class, 'service_type_id', 'id');
    }


    /**
     * 创建者
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @Author 姿势就是力量
     */
    public function creator()
    {
        return $this->belongsTo(Management::class, 'creator_id', 'id');

    }


    /**
     * 修改者
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @Author 姿势就是力量
     */
    public function modifier()
    {
        return $this->belongsTo(Management::class, 'modifier_id', 'id');
    }

}